﻿@using ES.Models
@{ var sales = (IList<Sale>)ViewBag.Sales;
   var basketProducts = (IList<Product>)ViewBag.BasketProducts;
}
@if (sales.Count != 0)
{
    <h3 style="height: 20px; border-bottom: 1px solid #f3f3f3;">
        Satın Aldıklarım</h3>

    <table>
        <th>
            Ürün Başlığı
        </th>
        <th>
            Fiyatı
        </th>
        <th>
            Satış Durumu
        </th>
        <th>
            Son İşlem Tarihi
        </th>
        @foreach (var item in sales)
        {
            <tr>
                <td>
                    @(((item.Product.Price * item.Product.Kdv)/100) + item.Product.Price)
                </td>
                <td>
                    @item.Product.Price
                </td>
                <td>
                    @{
            if (item.SaleState == (short)SaleState.PendingCheck)
            { <abbr>Onay Bekliyor</abbr>}
            else if (item.SaleState == (short)SaleState.PendingDelivery)
            {<abbr>Kargo Bekliyor</abbr>}           
            else if (item.SaleState == (short)SaleState.Complated)
            {<abbr>Satış Tamamlandı</abbr>}
            else if (item.SaleState == (short)SaleState.Cancel)
            {<abbr>Satış İptal Edildi</abbr>}
                    }
                </td>
                <td>
                    @(item.LastUpdateDate ?? item.RecordDate)
                </td>
            </tr>
        }
    </table>
}
@if (basketProducts.Count != 0)
{
        
   
    <h3 style="height: 20px; border-bottom: 1px solid #f3f3f3;">
        Sepetim</h3>
    <ul class="orderlinks">
        <li style="float: left; padding: 5px; border: 1px solid #f3f3f3; margin: 5px; list-style-type: none;">@UrlCreater.Create(ProductColumnEnum.Title, Request.Params)</li>
        <li style="float: left; padding: 5px; border: 1px solid #f3f3f3; margin: 5px; list-style-type: none;">@UrlCreater.Create(ProductColumnEnum.Price, Request.Params)</li>
        <li style="float: left; padding: 5px; border: 1px solid #f3f3f3; margin: 5px; list-style-type: none;">@UrlCreater.Create(ProductColumnEnum.Model, Request.Params)</li>
    </ul>
    <div class="tab-content" style="display: block; float: left;">
        <div class="items" style="width: 720px !important">
            <div class="cl">
                &nbsp;</div>
            <ul>
                @foreach (var item in basketProducts)
                {
                    <li>
                        @{Html.RenderPartial("SimpleProduct", item);}
                        <a class="removeBasketBtn" href="@Url.Action("RemoveBasket", "My", new { id = item.Id })">Sepetten Çıkar</a>
                        <a class="saleBtn" href="@Url.Action("Sale","Product",new {id=item.Id})">Satın Al</a>
                    </li>
                }
            </ul>
            <div class="cl">
                &nbsp;</div>
        </div>
    </div> 
}